package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 插入多个菜品
     *
     * @param setmealDishes
     */
    void insertBatch(List<SetmealDish> setmealDishes);

    @Select("select * from setmeal_dish where dish_id=#{dishId}")
    List<SetmealDish> getById(Long dishId);

    @Select("select * from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> getSetmealDishes(Long setmealId);

    /**
     * 删除套餐Id 删除套餐和菜品的关联关系
     * @param id
     */
    @Delete("delete from setmeal_dish where setmeal_id =#{setmealId}")
    void deleteBySetmealId(Long id);
}
